<template>
	<view class="content">
		<view class="card">
			<image :src="news.banner" mode="aspectFill"></image>
			<view class="txtBox">
				{{news.title}}
			</view>
			<view class="txtBox details">
				<!-- {{news.text}} -->
				<rich-text :nodes="news.text"></rich-text>
			</view>
		</view>
		<!-- <empty v-if="newsList.length==0" /> -->
	</view>
</template>

<script>
	import empty from "@/components/empty.vue"
	export default {
		components: {
			empty
		},
		data() {
			return {
				news: {},
			};
		},
		onShow() {

		},
		onLoad(options) {
			const that = this
			//2条新闻
			that.$api.request('news', 'detail', {
				id: options.id
			}, failres => {
				that.$api.msg(failres.errmsg)
			}).then(res => {
				console.log(res.data, '新闻')
				that.news = res.data
			})
		},
		onShareAppMessage() {
			const that = this
			return {
				title: '果王来了',
				imageUrl: 'https://shopmalling-asset.oss-cn-hangzhou.aliyuncs.com/share.jpg',
				path: '/pages/index/index'
			}
		},
		methods: {
			naviageToPage(page) {
				uni.navigateTo({
					url: page
				})
			},
		},
	}
</script>

<style lang="less" scoped>
	.content {
		.card {

			&:nth-child(n+2) {
				margin-top: 20upx;
			}

			image {
				width: 100%;
				height: 260upx;
				border-radius: 10upx;
			}

			.txtBox {
				padding: 20upx;
				background: #fff;
			}

			.details {
				font-size: 36upx;
				padding-top: 0;
				color: #535353;
			}
		}
	}
</style>
